;; This is lifted out of http://www.cs.indiana.edu/chezscheme/match/match.ss

(define classify-list
  (lambda (ls)
    (cond
     ((null? ls) 'proper)
     ((not (pair? ls)) 'improper)
     (else
      (let f ((tortoise ls) (hare (cdr ls)))
	(cond
	 ((eq? tortoise hare) 'infinite)
	 ((null? hare) 'proper)
	 ((not (pair? hare)) 'improper)
	 (else
	  (let ((hare (cdr hare)))
	    (cond
	     ((null? hare) 'proper)
	     ((not (pair? hare)) 'improper)
	     (else (f (cdr ls) (cdr hare))))))))))))
